package com.fitness.fitness.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fitness.fitness.modal.datavisual.entity.CourseTopNVisual;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface CourseTopNVisualMapper extends BaseMapper<CourseTopNVisual> {

    @Insert("<script>" +
            "insert into ads_course_topn(course_id,course_name,score) values" +
            "<foreach collection='topNVisuals' item='visual' separator=','>" +
            "( #{visual.courseId},#{visual.courseName},#{visual.score} )" +
            "</foreach>" +
            "on DUPLICATE KEY UPDATE score=values(score)" +
            "</script>")
    void updateCourseTopNVisuals(@Param("topNVisuals") List<CourseTopNVisual> topNVisuals);
}
